package choreganizer;

import java.io.*;
import java.net.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.border.*;



public class AboutDialog extends JDialog implements ActionListener
{
   
   public AboutDialog(JFrame owner)
   {
      super(owner, "About Choreganizer...", true);
   
		JLabel lbl = new JLabel();
		try {
			ImageIcon icon = null;
			URL iconURL = ClassLoader.getSystemResource("about.png");
			if (iconURL != null) {
				icon = new ImageIcon(iconURL);
				lbl = new JLabel( icon );
			}
		} catch (Exception e) {
			System.err.println("AboutDialog: can't find icon");
		}
        
      JPanel p = new JPanel();
      Border b1 = new BevelBorder(BevelBorder.LOWERED);
      Border b2 = new EmptyBorder(5, 5, 5, 5);
      lbl.setBorder(new CompoundBorder(b1,b2));
      
      p.add(lbl);
      getContentPane().add(p, BorderLayout.NORTH);
      
      p = new JPanel();
      p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
		
		JLabel txt = new JLabel(
			"<html>" +
			"By: James Sheets<br>" +
			"<a href=mailto:daelus@comcast.net>daelus@comcast.net</a><br>" +
			"copyright 2005<br><br>" +
			"Version 1.0" +
			"</html>"
			);
		txt.setBorder(new EmptyBorder(5, 10, 5, 10));
      
      p.add( txt );    
      getContentPane().add( p, BorderLayout.CENTER);
      
      JButton ok = new JButton("OK");
      ok.addActionListener(this);
      
      p = new JPanel( new FlowLayout(FlowLayout.RIGHT) );
      p.add(ok);
      getContentPane().add(p, BorderLayout.PAGE_END);
      
      pack();
      Dimension screen = Toolkit.getDefaultToolkit().getScreenSize();
		setLocation( (screen.width - getSize().width)/2, (screen.height - getSize().height)/2 );
      setResizable(false);
      setVisible(true);
   }
   
   public void actionPerformed(ActionEvent e)
   {
      setVisible(false);
      dispose();
   }
}
